package com.zone.infrastructure.persistent.po;

import com.zone.domain.award.model.entity.AwardEntity;
import lombok.Data;

import java.util.Date;
import java.util.Objects;

/**
 * @author: zongzi
 * @description: 奖品
 * @date: 2024/5/20
 */
@Data
public class Award {

    /** 自增ID */
    private Long id;
    /** 抽奖奖品ID - 内部流转使用 */
    private Integer awardId;
    /** 奖品对接标识 - 对应发奖策略 */
    private String awardKey;
    /** 奖品配置信息，发奖策略使用业务信息 */
    private String awardConfig;
    /** 奖品内容描述 */
    private String awardDesc;
    /** 创建时间 */
    private Date createTime;
    /** 更新时间 */
    private Date updateTime;

    public static AwardEntity convert2Entity(Award award) {
        if (Objects.isNull(award)) {
            return null;
        }
        AwardEntity awardEntity = new AwardEntity();
        awardEntity.setAwardId(award.getAwardId());
        awardEntity.setAwardKey(award.getAwardKey());
        awardEntity.setAwardConfig(award.getAwardConfig());
        awardEntity.setAwardDesc(award.getAwardDesc());
        return awardEntity;
    }
}
